// 配置测试脚本
console.log('🔧 测试DeepSeek配置...\n');

// 模拟配置
const config = {
    apiKey: 'hKTj5Z46h-BKXumnyr1Apl6KX3zB6F8E3MZcUhpQ',
    baseUrl: 'https://api.qnaigc.com',
    model: 'deepseek-v3'
};

console.log('📋 当前配置:');
console.log('API Key:', config.apiKey ? '已配置' : '未配置');
console.log('Base URL:', config.baseUrl);
console.log('Model:', config.model);

// 测试API URL构建
const apiUrl = config.baseUrl.endsWith('/') ? 
    (config.baseUrl + 'v1/chat/completions') : 
    (config.baseUrl + '/v1/chat/completions');

console.log('\n🔗 API URL:', apiUrl);

// 测试请求体构建
const testPrompt = '你好，请介绍一下你自己';
const requestBody = {
    model: config.model,
    messages: [
        {
            role: 'system',
            content: 'You are RoleRealm AI assistant, specialized in role-playing and character simulation. You excel at adopting different character personas including fictional characters (like Harry Potter, Conan), historical figures (like Socrates), and any other characters. When role-playing, you should: 1) Maintain the character\'s unique speaking style, vocabulary, and mannerisms; 2) Stay in character throughout the conversation; 3) Respond naturally and authentically as that character would; 4) Use appropriate tone and personality traits. You can also provide helpful information while staying in character.'
        },
        {
            role: 'user',
            content: testPrompt
        }
    ],
    temperature: 0.8,
    max_tokens: 2000
};

console.log('\n📝 请求体示例:');
console.log(JSON.stringify(requestBody, null, 2));

console.log('\n✅ 配置测试完成！');
console.log('💡 如果后端服务启动成功，这些配置应该能正常工作。');
